import React from "react";
import "./CompItem.css";
import subscriberAndRelease from "../../componentGlobalData"

export default class CompItem extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            _option: props.option,
            isShowDetail: false
        }
    }
    compBoxClick(param, event) {
        subscriberAndRelease.getRelease("openmainDetail")({
            detailOption: param,
            isShowDetail: !this.state.isShowDetail
        })
        this.setState({
            isShowDetail: !this.state.isShowDetail
        })
    }
    render() {
        return (
            <div className="compBox" onClick={this.compBoxClick.bind(this, this.state._option.item)}>
                <div className="comp-icon">
                    <img src={this.state._option.item.imgurl} style={{ width: '100%', height: '100%' }} alt=""></img>
                </div>
                <div className="comp-tilte">
                    {this.state._option.item.name}
                </div>
                <div className="comp-illustrate">
                    <span>简介：</span>{this.state._option.item.instructions}
                </div>
            </div>
        )
    }
}